﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Text;

namespace TCPRPCClient
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                TcpClientChannel tc = new TcpClientChannel();
                ChannelServices.RegisterChannel(tc,false);
                TcpIpc.IGetRpcInfo obj = (TcpIpc.IGetRpcInfo)Activator.GetObject(typeof(TcpIpc.IGetRpcInfo), "tcp://127.0.0.1:8099/hi");
                if (obj == null)
                {
                    Console.WriteLine("FAILED!");
                    return;
                }
                for (int i = 0; i < 2; i++)
                {
                    Console.WriteLine(obj.GetVersion);
                    Console.WriteLine(obj.Test(1));
                    Console.ReadLine();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.Source);
                Console.ReadLine();
            }   
        }
    }
}
